﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Util.Model;

namespace DataBase
{
    [Table("Decision")]
    public class Decision
    {
        /// <summary>
        /// 主键，自动递增
        /// </summary>
        [Key]
        [Column("ID")]
        public int ID { get; set; }


        /// <summary>
        /// 排序
        /// </summary>

        [Column("Sort")]
        public int Sort { get; set; }

        /// <summary>
        /// 类型
        /// </summary>

        [Column("Type")]
        public string Type { get; set; }


        /// <summary>
        /// 类型
        /// </summary>

        [Column("X1")]
        public double X1 { get; set; }

        /// <summary>
        /// 类型
        /// </summary>

        [Column("X2")]
        public double X2 { get; set; }

        /// <summary>
        /// 类型
        /// </summary>

        [Column("Y1")]
        public double Y1 { get; set; }


        /// <summary>
        /// 类型
        /// </summary>

        [Column("Y2")]
        public double Y2 { get; set; }
        /// <summary>
        /// 类型
        /// </summary>

        [Column("PressId")]
        public string  PressId { get; set; }

        /// <summary>
        /// 类型
        /// </summary>

        [Column("Image")]
        public string Image { get; set; }

        /// <summary>
        /// Xstr
        /// </summary>

        [Column("X1str")]
        public string? X1str { get; set; }

        /// <summary>
        /// Ystr
        /// </summary>

        [Column("Y1str")]
        public string? Y1str { get; set; }

        [Column("X2str")]
        public string? X2str { get; set; }

        /// <summary>
        /// Ystr
        /// </summary>

        [Column("Y2str")]
        public string? Y2str { get; set; }

        /// <summary>
        /// 父Id
        /// </summary>

        [Column("ParentId")]
        public string ? ParentId { get; set; }


        public Border DecisionToBorder(Decision decision)
        {
            Border res = new();
            res.X1 = decision.X1;
            res.X2 = decision.X2;
            res.Y1 = decision.Y1;
            res.Y2 = decision.Y2;
            res.BorderType = decision.Type;
            return res;
        }
    }
}
